<template>
	<view>
		<view class="input-item">
			<view class="title"><text class="iconfont">&#xe7b2;</text>团队名称</view>
			<view class="input-content">
				<input class="text-input" type="text" placeholder="请输入团队名称" v-model="name" />
			</view>
		</view>
		<view class="textarea">
			<textarea placeholder="请输入团队描述" v-model="con" />
			</view>
		<view class="bottom">
			<button type="primary"@click="submit"><text class="iconfont" style="color: #FFFFFF;">&#xe64a;</text>保存信息</button>
		</view>
	</view>
</template>
<script>
	import {editTeam,delTeamApply,getTeamInfo} from '@/api/tTeam.js'
	export default {
		data() {
			return {
				name:'',
				con:'',
				teaTeamChangeId:''
			}
		},
		methods: {
			submit(){
				editTeam({
					tid:getApp().globalData.tid,
					name:this.name,
					con:this.con,
					teaTeamId:this.teaTeamId
				}).then(res=>{
					if(res.data.code==0){
						uni.showModal({
							content:'操作成功',
							success:()=> {
								delTeamApply({
									teaTeamChangeId:this.teaTeamChangeId
								})
							uni.navigateBack()	
							}
						})
					}else{
						uni.showModal({
							content:'操作失败'
						})
					}
				}).catch(err=>{
					uni.showModal({
						content:'请求失败'
					})
				})
			}
		},
		onLoad(option) {
			this.teaTeamId = option.teaTeamId
			this.teaTeamChangeId=option.teaTeamChangeId
			// console.log(option)
			uni.showLoading()
			getTeamInfo({
				teamId:option.teaTeamId
			}).then(res=>{
				// console.log(res)
				this.name=res.data.data.name
				this.con=res.data.data.con
				uni.hideLoading()
			})
		}
	}
</script>

<style>
	.input-item {
		height: auto;
		position: relative;
		height: 40px;
		margin: 0 10px;
		border-bottom: 1px solid #C0C0C0;
		font-family: 'Courier New', Courier, monospace;
	}
	.iconfont {
		font-family: "iconfont" !important;
		font-style: normal;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
		/* color: #C0C0C0; */
		font-size: 20px;
		margin-right: 5px;
		color: #e64340;
	}

	.input-item .title {
		position: absolute;
		top: 0;
		left: 0;
		width: 30%;
		height: 100%;
		text-align: center;
		line-height: 40px;
	}

	.input-item .input-content {
		position: absolute;
		top: 0;
		right: 0;
		width: 70%;
		height: 100%;
	}

	.input-item .input-content .text-input {
		position: absolute;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 100%;
	}
	.textarea{
		margin-top: 15px;
		padding: 0 10px;
		height: 150px;
	}
	.textarea textarea{
		width: 100%;
		border-radius: 10px;
		border: 1px solid #808080;
		font-family: 'Courier New', Courier, monospace;
	}
	.bottom{
		margin-top: 30px;
		padding: 0 10px;
	}
	
	
</style>
